#ifndef FLOCK_H
#define FLOCK_H

#include "BlendedSteering.h"
#include "Separation.h"
#include "Cohesion.h"
#include "VelocityMatch.h"
#include "Agent.h"

namespace Engine
{
	namespace GroupSteeringTypes
	{
		const unsigned int FLOCK = Hash("Flock");
	}

	class Flock : public BlendedSteering
	{
		private:
			Separation m_separation;
			Cohesion m_cohesion;
			VelocityMatch m_velocityMatch;

			float m_timeBetweenGroupChecks;
			float m_timeToNextCheck;

			Agent m_velMatchTarget;

		public:
			Flock();

			//inherited from SteeringBehaviour
			virtual const char* GetTypeName() const override {return "Flock";}
			virtual unsigned int GetHash() const override {return GroupSteeringTypes::FLOCK;}
			virtual void Update(SteeringOutput* output) override;
			virtual void SetParent(Agent* parent) override;

			//setters
			void SetValues(float separationThreshold, 
						   float separationDecayCoefficient, 
				           float cohesionThreshold, 
						   float cohesionDecayCoefficient,
						   float velMatchTimeToTarget, 
						   float timeBetweenGroupChecks);

			void SetSeparationValues(float threshold, float decayCoefficient);
			void SetCohesionValues(float threshold, float decayCoefficient);
			void SetVelocityMatchTimeToTarget(float t);
			void SetTimeBetweenGroupChecks(float t) {m_timeBetweenGroupChecks = t;}

			//getters
			float GetSeparationThreshold() const;
			float GetSeparationDecayCoefficient() const;
			float GetCohesionThreshold() const;
			float GetCohesionDecayCoefficient() const;
			float GetVelMatchTimeToTarget() const;
			float GetTimeBetweenGroupChecks() const {return m_timeBetweenGroupChecks;}
	};
}

#endif